<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Book List</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f2f2f2;
        }

        h1 {
            text-align: center;
            color: #333333;
            margin-top: 30px;
        }

        table {
            border-collapse: collapse;
            width: 100%;
            background-color: #ffffff;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        th, td {
            padding: 12px 16px;
            text-align: left;
            border-bottom: 1px solid #dddddd;
        }

        th {
            background-color: #f2f2f2;
            color: #333333;
        }

        form {
            margin-bottom: 20px;
            background-color: #ffffff;
            padding: 20px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        label {
            display: inline-block;
            width: 80px;
            color: #333333;
            font-weight: bold;
        }

        input[type="text"] {
            width: 200px;
            padding: 8px;
            border: 1px solid #dddddd;
            border-radius: 4px;
        }

        input[type="submit"] {
            margin-top: 10px;
            padding: 8px 16px;
            background-color: #4caf50;
            color: #ffffff;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }

        input[type="submit"]:hover {
            background-color: #45a049;
        }

        div {
            margin-top: 20px;
            text-align: center;
        }

        a {
            text-decoration: none;
            color: #ffffff;
            background-color: #333333;
            padding: 6px 12px;
            border-radius: 4px;
        }

        a:hover {
            background-color: #555555;
        }
    </style>
    <script>
        $(document).ready(function(){
            $("form").submit(function(){
                if($("input[name='id']").val() === ""){
                    $("input[name='id']").val("0");
                }
            });
        });
    </script>
</head>
<body>
<h1>Book List</h1>
<form action="/list" method="post">
    <label>ID:</label>
    <input type="text" name="id">
    <label>Title:</label>
    <input type="text" name="title">
    <input type="submit" value="Search">
</form>
<table>
    <tr>
        <th>ID</th>
        <th>Title</th>
        <th>Author</th>
        <th>Publication Year</th>
        <th>Price</th>
        <th>Actions</th>
    </tr>
    <tr th:each="book : ${bookList}">
        <td th:text="${book.id}"></td>
        <td th:text="${book.title}"></td>
        <td th:text="${book.author}"></td>
        <td th:text="${book.publicationYear}"></td>
        <td th:text="${book.price}"></td>
        <td>
            <a th:href="@{/delete/{id}(id=${book.id})}">Delete</a>
            <a th:href="@{/update/{id}(id=${book.id})}">Update</a>
        </td>
    </tr>
</table>
<div>
    <a th:href="create">Create</a>
</div>
</body>
</html>